package com.atguigu.timedTask;

import com.atguigu.entity.BirthAndDeath;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

public class MessageSource {

    public static BirthAndDeath produce() {

        BirthAndDeath birthAndDeath = new BirthAndDeath();

        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        Date date = new Date();
        String format = simpleDateFormat.format(date);

        String[] familyNameS = {"赵","钱","孙","李","周","吴","郑","王","冯","陈","朱","侯","蒋","沈","韩","杨"};
        String[] names = {"建国","伟","强","波","丽","娜","刚","燕","卫国","芳","勇","杰","霞","娟","磊","敏","军","超"};

        String[] birthOrDeath = {"出生","死亡"};

        birthAndDeath.setDate(format);

        birthAndDeath.setName(familyNameS[(int)(0 + Math.random() * (10 - 0 + 1))] + names[(int)(0 + Math.random() * (10 - 0 + 1))]);

        birthAndDeath.setBirthOrDeath(birthOrDeath[(int)(0 + Math.random() * (1 - 0 + 1))]);

        return birthAndDeath;
    }

}
